package com.jj.buy.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.jj.buy.entities.User;
import com.jj.buy.service.Userservice;


@RestController
public class JJBuy {
@Autowired
private DiscoveryClient client;
@Autowired
private Userservice service;

@RequestMapping(value="/dept/add",method=RequestMethod.POST)
public boolean add(@RequestBody User dept)
{
 return service.add(dept);
}

@RequestMapping(value="/dept/get/{id}",method=RequestMethod.GET)
public User get(@PathVariable("id") String id)
{
 return service.get(id);
}

@RequestMapping(value="/dept/list",method=RequestMethod.GET)
public List<User> list()
{
 return service.list();
}
}
